<div class="problemindexholder" problemindex="C">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     C. Four Segments
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     1 second
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     You are given an array of
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     integer numbers. Let
     <span class="tex-span">
      <i>
       sum
      </i>
      (
      <i>
       l
      </i>
      ,
      <i>
       r
      </i>
      )
     </span>
     be the sum of all numbers on positions from
     <span class="tex-span">
      <i>
       l
      </i>
     </span>
     to
     <span class="tex-span">
      <i>
       r
      </i>
     </span>
     non-inclusive (
     <span class="tex-span">
      <i>
       l
      </i>
     </span>
     -th element is counted,
     <span class="tex-span">
      <i>
       r
      </i>
     </span>
     -th element is not counted). For indices
     <span class="tex-span">
      <i>
       l
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       r
      </i>
     </span>
     holds
     <span class="tex-span">
      0 ≤
      <i>
       l
      </i>
      ≤
      <i>
       r
      </i>
      ≤
      <i>
       n
      </i>
     </span>
     . Indices in array are numbered from
     <span class="tex-span">
      0
     </span>
     .
    </p>
    <p>
     For example, if
     <span class="tex-span">
      <i>
       a
      </i>
      = [ - 5, 3, 9, 4]
     </span>
     , then
     <span class="tex-span">
      <i>
       sum
      </i>
      (0, 1) =  - 5
     </span>
     ,
     <span class="tex-span">
      <i>
       sum
      </i>
      (0, 2) =  - 2
     </span>
     ,
     <span class="tex-span">
      <i>
       sum
      </i>
      (1, 4) = 16
     </span>
     and
     <span class="tex-span">
      <i>
       sum
      </i>
      (
      <i>
       i
      </i>
      ,
      <i>
       i
      </i>
      ) = 0
     </span>
     for each
     <span class="tex-span">
      <i>
       i
      </i>
     </span>
     from
     <span class="tex-span">
      0
     </span>
     to
     <span class="tex-span">
      4
     </span>
     .
    </p>
    <p>
     Choose the indices of three delimiters
     <span class="tex-span">
      <i>
       delim
      </i>
      <sub class="lower-index">
       0
      </sub>
     </span>
     ,
     <span class="tex-span">
      <i>
       delim
      </i>
      <sub class="lower-index">
       1
      </sub>
     </span>
     ,
     <span class="tex-span">
      <i>
       delim
      </i>
      <sub class="lower-index">
       2
      </sub>
     </span>
     (
     <span class="tex-span">
      0 ≤
      <i>
       delim
      </i>
      <sub class="lower-index">
       0
      </sub>
      ≤
      <i>
       delim
      </i>
      <sub class="lower-index">
       1
      </sub>
      ≤
      <i>
       delim
      </i>
      <sub class="lower-index">
       2
      </sub>
      ≤
      <i>
       n
      </i>
     </span>
     ) and divide the array in such a way that the value of
     <span class="tex-span">
      <i>
       res
      </i>
      =
      <i>
       sum
      </i>
      (0,
      <i>
       delim
      </i>
      <sub class="lower-index">
       0
      </sub>
      )
     </span>
     -
     <span class="tex-span">
      <i>
       sum
      </i>
      (
      <i>
       delim
      </i>
      <sub class="lower-index">
       0
      </sub>
      ,
      <i>
       delim
      </i>
      <sub class="lower-index">
       1
      </sub>
      )
     </span>
     +
     <span class="tex-span">
      <i>
       sum
      </i>
      (
      <i>
       delim
      </i>
      <sub class="lower-index">
       1
      </sub>
      ,
      <i>
       delim
      </i>
      <sub class="lower-index">
       2
      </sub>
      )
     </span>
     -
     <span class="tex-span">
      <i>
       sum
      </i>
      (
      <i>
       delim
      </i>
      <sub class="lower-index">
       2
      </sub>
      ,
      <i>
       n
      </i>
      )
     </span>
     is maximal.
    </p>
    <p>
     Note that some of the expressions
     <span class="tex-span">
      <i>
       sum
      </i>
      (
      <i>
       l
      </i>
      ,
      <i>
       r
      </i>
      )
     </span>
     can correspond to empty segments (if
     <span class="tex-span">
      <i>
       l
      </i>
      =
      <i>
       r
      </i>
     </span>
     for some segment).
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     The first line contains one integer number
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       n
      </i>
      ≤ 5000
     </span>
     ).
    </p>
    <p>
     The second line contains
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     numbers
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       0
      </sub>
      ,
      <i>
       a
      </i>
      <sub class="lower-index">
       1
      </sub>
      , ...,
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        n
       </i>
       - 1
      </sub>
     </span>
     (
     <span class="tex-span">
      - 10
      <sup class="upper-index">
       9
      </sup>
      ≤
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤ 10
      <sup class="upper-index">
       9
      </sup>
     </span>
     ).
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Choose three indices so that the value of
     <span class="tex-span">
      <i>
       res
      </i>
     </span>
     is maximal. If there are multiple answers, print any of them.
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>3<br/>-1 2 3<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>0 1 3<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>4<br/>0 0 -1 0<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>0 0 0<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>1<br/>10000<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>1 1 1<br/></pre>
     </div>
    </div>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
